#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
const int N = 5e4 + 10;
int tree[N];
int n;
string s;
int lowbit(int x)
{
	return x & -x;
}
void add(int x, int v)
{
	for (int i = x; i < N; i += lowbit(i)) {
		tree[i] += v;
	}
}
int query(int x)
{
	int ans = 0;
	for (int i = x; i; i -= lowbit(i)) {
		ans += tree[i];
	}
	return ans;
}
int main()
{
	int t;
	cin >> t;
	int k = 1;
	while (t--) {
		memset(tree, 0, sizeof(tree));
		cout << "Case " << k++ << ":" << endl;
		int x;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			scanf_s("%d", &x);
			add(i, x);
		}
		int a, b;
		while (cin >> s) {
			if (s == "End") {
				break;
			}
			scanf_s("%d%d", &a, &b);
			if (s == "Add") {
				add(a, b);
			}
			else if (s == "Sub") {
				add(a, -b);
			}
			else {
				cout << query(b) - query(a - 1) << endl;
			}
		}
	}
	return 0;
}